package com.gb.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author lgoodbook@163.com
 * @version 1.0.0
 * @Date 2017-08-10 17:26
 */
//@Configuration
public class MvcConfig  extends WebMvcConfigurerAdapter {

    protected Logger log = LoggerFactory.getLogger(MvcConfig.class);

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        log.info("======MvcConfig.addViewControllers======");
        registry.addViewController("/error").setViewName("error.html");
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
    }

    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        log.info("======MvcConfig.configurePathMatch======");
        super.configurePathMatch(configurer);
        configurer.setUseSuffixPatternMatch(false);
    }

}
